<?php
header('content-type: text/html;charset=utf-8;');
$myname = $_POST['mname'];
$myphone = $_POST['mphone'];
$mypwd = $_POST['mpwd'];

$link = mysqli_connect('localhost','root','root','damai');
$sql = " INSERT INTO `users`(`user`,`pwd`,`name`) VALUES('$myphone','$mypwd','$myname')";
$sql1 = "SELECT * FROM  `users` WHERE `user`='$myphone'";
$res1 =  mysqli_query($link,$sql1);
$row = mysqli_fetch_assoc($res1);
$arr = array(
  "username" => $myphone,
  "pwd" => $mypwd
);
if($row){

}else{
  $res = mysqli_query($link,$sql);
  mysqli_close($link);
  echo  json_encode($arr);
}
?>